#pragma once
#include <iostream>
#include <string>
#include <unistd.h>

class Channel
{
public:
    Channel(int wfd,int who) 
        :_wfd(wfd),_who(who)
        {
            _name = "Channel-" + std::to_string(_wfd) + "-" + std::to_string(who);
        }
    std::string Name() {return _name;}
    int Who() { return _who;}
    int Wfd() { return _wfd;}
    void Close() {::close(_wfd);}
    void Send(int cmd){
        ::write(_wfd,&cmd,sizeof(cmd));
    }
    ~Channel() {}
private:
    int _wfd;
    int _who;
    std::string _name;
};